package com.yhy.common.security.model;


import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.Setter;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.util.Collection;

/**
 * 扩展用户信息
 */
public class MyUser extends User {

    /**
     *
     */
    @JsonIgnore
    private static final long serialVersionUID = 8567482453015650896L;

    @Getter
    @Setter
    private Long id;

    @Getter
    @Setter
    private String clientId;

    @Getter
    @Setter
    private transient String token;

    public MyUser(Long id, String clientId, String username, String password, boolean enabled,
                  boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked,
                  Collection<? extends GrantedAuthority> authorities) {
        super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
        this.clientId = clientId;
        this.id = id;
    }

}
